from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from info import set_app, db
from config import DevelopmentConfig, ProductionConfig


# 这里直接选择以哪种模式运行程序
app = set_app(DevelopmentConfig)

# 拥有命令行
manager = Manager(app)
# 迁移关联了app和数据库对象
Migrate(app, db)
# 添加db命令，控制迁移
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
